package migrate

import (
	"sale-admin/config/mysql"
)

type MigrateFunc struct{}

// Script1 处理键长度问题
func (MigrateFunc) Script1() error {
	mysql.NewDB().Exec("alter table `ma_ad` modify column `Name` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '广告名称'")
	mysql.NewDB().Exec("alter table `ma_ad` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '投放机器标识ID'")
	mysql.NewDB().Exec("alter table `ma_ad` modify column `LaunchScope` text NOT NULL COMMENT '投放范围'")

	mysql.NewDB().Exec("alter table `ma_ai_service_face_count` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '售货识别ID 序列号' ")
	mysql.NewDB().Exec("alter table `ma_ai_service_face_count` modify column `RobotName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '机器人名称'")

	mysql.NewDB().Exec("alter table `ma_goods` modify column `ClassName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '类目名称1'")

	mysql.NewDB().Exec("alter table `ma_goods_click` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '售货识别ID 序列号'")
	mysql.NewDB().Exec("alter table `ma_goods_click` modify column `RobotName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '机器人名称'")

	mysql.NewDB().Exec("alter table `ma_order` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '机器标识ID'")
	mysql.NewDB().Exec("alter table `ma_order` modify column `OutTradeNo` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '订单号'")
	mysql.NewDB().Exec("alter table `ma_order` modify column `ReFunTradeNo` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '退款交易号'")
	mysql.NewDB().Exec("alter table `ma_order` modify column `EndOutTradeNo` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL")

	mysql.NewDB().Exec("alter table `ma_order_details` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `WechatCreatResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `AlipayCreatResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `WechatQueryResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `AlipayQueryResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `QueryResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `SuccessResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `CloseResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `JuheWechatCreatResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `JuheAlipayCreatResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_details` modify column `Times` text COLLATE utf8mb4_bin")

	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `OutTradeNo` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `OutReFundNo` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `AddTime` datetime DEFAULT NULL")
	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `AliPayResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `WeChatResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `AliPayQueryResult` text COLLATE utf8mb4_bin")
	mysql.NewDB().Exec("alter table `ma_order_refund` modify column `WeChatQueryResult` text COLLATE utf8mb4_bin")

	mysql.NewDB().Exec("alter table `ma_payment_alipay` modify column `AliPayAppID` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '支付宝AppID'")
	mysql.NewDB().Exec("alter table `ma_payment_alipay` modify column `AliPayPrivateKey` text COLLATE utf8mb4_bin COMMENT '支付宝密钥'")

	mysql.NewDB().Exec("alter table `ma_payment_dx` modify column `Name` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_payment_dx` modify column `DxAppID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '聚合支付密码'")
	mysql.NewDB().Exec("alter table `ma_payment_dx` modify column `DxAppKey` varchar(50) COLLATE utf8mb4_bin NOT NULL DEFAULT '0'")
	mysql.NewDB().Exec("alter table `ma_payment_dx` modify column `DxSellerID` varchar(100) COLLATE utf8mb4_bin NOT NULL COMMENT '大兴收款账户'")
	mysql.NewDB().Exec("alter table `ma_payment_dx` modify column `DxMerchantID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '大兴商铺号'")
	mysql.NewDB().Exec("alter table `ma_payment_dx` modify column `DxShopID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '大兴商场号'")

	mysql.NewDB().Exec("alter table `ma_payment_jh` modify column `JhMerchantNum` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '聚合商户号'")
	mysql.NewDB().Exec("alter table `ma_payment_jh` modify column `JhApiKey` varchar(200) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '聚合支付密码'")

	mysql.NewDB().Exec("alter table `ma_payment_wechat` modify column `WeChatmchID` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '微信支付商户号 PartnerID'")
	mysql.NewDB().Exec("alter table `ma_payment_wechat` modify column `WeChatAppID` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '微信公众号AppID'")
	mysql.NewDB().Exec("alter table `ma_payment_wechat` modify column `WeChatAppKey` varchar(200) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '微信支付密钥'")

	mysql.NewDB().Exec("alter table `ma_physical_info` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_redemption_code` modify column `RedemptionCode` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '兑换码内容'")
	mysql.NewDB().Exec("alter table `ma_redemption_code` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '售货识别ID 序列号'")
	mysql.NewDB().Exec("alter table `ma_redemption_code` modify column `RobotName` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '机器人名称'")
	mysql.NewDB().Exec("alter table `ma_redemption_code` modify column `OutTradeNo` varchar(50) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '订单编号'")

	mysql.NewDB().Exec("alter table `ma_robot` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '售货识别ID 序列号'")
	mysql.NewDB().Exec("alter table `ma_robot` modify column `RobotName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '机器人名称'")

	mysql.NewDB().Exec("alter table `ma_robot_error_log_pallets` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_robot_report` modify column `RobotName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '机器名称'")
	mysql.NewDB().Exec("alter table `ma_robot_sales_info` modify column `SalesID` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '售货识别ID'")
	mysql.NewDB().Exec("alter table `ma_tag` modify column `Name` varchar(50) COLLATE utf8mb4_bin NOT NULL")
	mysql.NewDB().Exec("alter table `ma_user` modify column `UserName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '用户名'")
	mysql.NewDB().Exec("alter table `ma_user_shop_info` modify column `UserName` varchar(50) COLLATE utf8mb4_bin NOT NULL COMMENT '用户名'")
	return nil
}
